<?php
include 'PublicdetailController.php';
class RoomController extends PublicdetailController{
	public function listAction() {
	$this->_helper->layout ()->disableLayout ();
		$model = new Model_Room();
		//die(get_class($model));
		$this->view->items = $model->searchAvai(@$_REQUEST['startTime'], @$_REQUEST['endTime']);
	}
	
	public function searchAction() {
		$this->_helper->layout ()->disableLayout ();
		$model = new Model_Room();
		if(@$_REQUEST['startTime']) {
			$_REQUEST['startTime'] = date('Y-m-d H:i:s', strtotime($_REQUEST['startTime']));
		}
		if(@$_REQUEST['endTime']) {
			$_REQUEST['endTime'] = date('Y-m-d H:i:s', strtotime($_REQUEST['endTime']));
		}
		$data = $model->searchAvai(@$_REQUEST['startTime'], @$_REQUEST['endTime']);
		$arr = array();
		foreach($data as $row) {
			$arr[] = $row;
		}
		echo json_encode($arr);
		die();
	}
}
?>